﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Web_KFJB : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        btnOK.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并提交么？" + "')== false) return false;");
        
        if (!IsPostBack)
        {
            
            
            txtCS.Text = BLLFactory.CreateDxcBLL().DXCS(Session["用户信息.部门"].ToString());
            txtCS.Attributes["contentEditable"] = "false";
            txtDUN.Text = BLLFactory.CreateDxcBLL().JBDX(Session["用户信息.部门"].ToString());
            txtDUN.Attributes["contentEditable"] = "false";


        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int checkValue = 0;
        JbInfo jb = new JbInfo();
        jb.Ku = Session["用户信息.部门"].ToString();
        jb.Jday = DateTime.Now.ToString();
        string nowtime = DateTime.Now.ToShortTimeString().ToString();
        string time1 = "08:00:00";
        string time2 = "20:00:00";
        string time3 = "16:00:00";
        string time4 = "23:59:59";
        DateTime dt1 = Convert.ToDateTime(nowtime);
        DateTime dt2 = Convert.ToDateTime(time1);
        DateTime dt3 = Convert.ToDateTime(time2);
        DateTime dt4 = Convert.ToDateTime(time3);
        DateTime dt5 = Convert.ToDateTime(time4);
        if (Session["用户信息.部门"].ToString() == "大棒线")
        {
            if (DateTime.Compare(dt1, dt2) <= 0)
                jb.Banbie = "夜";
            else if (DateTime.Compare(dt1, dt4) <= 0)
                jb.Banbie = "白";
            else
                jb.Banbie = "中";
        }
        else
        {
            if (DateTime.Compare(dt1, dt2) < 0 || DateTime.Compare(dt1, dt3) > 0)
            {
                jb.Banbie = "夜";
            }
            else
                jb.Banbie = "白";
        }

        jb.Banzu = Session["用户信息.班组"].ToString();
        jb.Tianbao = Session["用户信息.姓名"].ToString();
        jb.Shebei = txtShebei.Text.ToString();
        jb.Yanxu = txtYanxu.Text.ToString();
        jb.Num = BLLFactory.CreateJbBLL().AUTOID(jb.Ku);
        checkValue = BLLFactory.CreateJbBLL().AddJb(jb);
        if (checkValue >= 1)
        {
            Response.Write(" <script   language=javascript> window.alert( ' 提交成功！ ');</script> ");
        }
        if (txtInfo.Text.ToString() != "")
            BLLFactory.CreateJbBLL().UpdateInfo(jb.Num, txtInfo.Text.ToString());
        
        

    }
    protected void btnRepeat_Click(object sender, EventArgs e)
    {
        
        
        txtShebei.Text = "";
        txtYanxu.Text = "";
        txtInfo.Text = "";
    }
    protected void btnQKJL_Click(object sender, EventArgs e)
    {
        Response.Redirect("JBJL.aspx");
    }
    protected void btnDXC_Click(object sender, EventArgs e)
    {
        Response.Redirect("DXCJL.aspx");
    }
    

    
    
}
